<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"%>
<%@ include file="/WEB-INF/jspf/taglibs.jspf" %>
<%-- <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> --%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>用户登录</title>
<link rel="stylesheet" type="text/css" href="<%=basePath %>css/styles.css">
  </head>
  <body >
  <div class="container" >
    <div class="login" style="margin-top:22%;">
      <h1><b>登录</b></h1>
   <form:form modelAttribute="form" id="page-sign-in-form" class="form-horizontal" action="sign_in"
           method="post">
        <p><label>登录名：</label>
        <form:input path="loginName" autofocus="true" data-placement="top" placeholder="登录名" cssStyle="width: 180px;"
                                cssClass="form-control" required="required" autocomplete="false"/>&nbsp;&nbsp;
                    <form:errors path="loginName" cssClass="errmsg" cssStyle="color:red;"/>
        </p>
        <p><label>密&nbsp;&nbsp;&nbsp;码：</label>
         <form:password path="loginPassword" data-placement="top" placeholder="密码" cssStyle="width: 180px;"
                                       autocomplete="off"   cssClass="form-control" required="required"/>&nbsp;&nbsp;
                        <form:errors path="loginPassword" cssClass="errmsg" cssStyle="color:red;"/>
        </p>
        <p><label>验证码：</label>
       <form:input path="captcha" data-placement="top" id="captcha" cssStyle="width: 90px;" placeholder="验证码"
                                                    cssClass="form-control captcha"
                                                    required="required"/>
        <img src="captcha" onclick="test();" style="cursor:pointer;width:90px;" id="validateImg"/>&nbsp;&nbsp;<form:errors path="captcha" cssClass="errmsg" cssStyle="color:red;"/>
        </p>
        <p class="remember_me">
          <label>
          </label> 
        </p>
        <p class="submit"><input type="submit" name="commit" value="登录"></p>
        </form:form>
    </div>
  </div>
  </body>
</html>
<script type="text/javascript" src="<%=basePath%>js/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		/* $("input[type='button']").click(function(){
			var result=true;
			$("input").each(function(){
				if($(this).attr('name')=="loginName" && $(this).val()==""){
					$(this).next().text("请输入用户名！");
					result=false;	
				}
				if($(this).attr('name')=="loginPassword" && $(this).val()==""){
					$(this).next().text("请输入密码！");
					result=false;
				}
				if($(this).attr('name')=="captcha" && $(this).val()==""){
					$(this).next().text("请输入验证码！");
					result=false;
				}
			});
			if(result){
				$("form").submit();	
			}
		})
		if(${result!=null}){
			alert("${result}")
		} */
	})
	function test(){
		$.post("captcha",function(){
			$("#validateImg").attr("src","captcha");
		})
	}
</script>
